home *** CD-ROM | disk | FTP | other *** search
/ JuniorNet 1.1 / juniornet.bin / SETUP / CDcontent / ZI / ZIPL / ZIPL003x1.dcr / 00055_Tri-State ButtonS.ls < prev    next >
Encoding:
Text File  |  1999-02-21  |  2.5 KB  |  67 lines

  1. property imageup, imageroll, imagedown, clicked, pSoundDown, pSoundDownChannel, pSoundRoll, pSoundRollChannel
  2.  
  3. on mouseEnter me
  4.   if me.clicked then
  5.     if the mouseDown then
  6.       set the member of sprite the spriteNum of me to me.imagedown
  7.     else
  8.       set the member of sprite the spriteNum of me to me.imageroll
  9.     end if
  10.   else
  11.     set the member of sprite the spriteNum of me to me.imageroll
  12.   end if
  13.   if pSoundRoll <> EMPTY then
  14.     puppetSound(pSoundRollChannel, pSoundRoll)
  15.   end if
  16.   updateStage()
  17. end
  18.  
  19. on mouseDown me
  20.   set the member of sprite the spriteNum of me to me.imagedown
  21.   me.clicked = 1
  22.   if pSoundDown <> EMPTY then
  23.     puppetSound(pSoundDownChannel, pSoundDown)
  24.   end if
  25.   updateStage()
  26.   pass()
  27. end
  28.  
  29. on mouseLeave me
  30.   set the member of sprite the spriteNum of me to me.imageup
  31. end
  32.  
  33. on mouseUp me
  34.   set the member of sprite the spriteNum of me to me.imageroll
  35.   if me.clicked then
  36.     me.clicked = 0
  37.     pass()
  38.   end if
  39. end
  40.  
  41. on mouseUpOutSide me
  42.   set the member of sprite the spriteNum of me to me.imageup
  43.   me.clicked = 0
  44. end
  45.  
  46. on beginSprite me
  47.   me.clicked = 0
  48. end
  49.  
  50. on getPropertyDescriptionList
  51.   if the currentSpriteNum = 0 then
  52.     memdefault1 = 0
  53.   else
  54.     memref = the member of sprite the currentSpriteNum
  55.     castLibNum = memref.castLibNum
  56.     memdefault0 = member(member(memref).memberNum, castLibNum)
  57.     memdefault1 = member(member(memref).memberNum + 1, castLibNum)
  58.     memdefault2 = member(member(memref).memberNum + 2, castLibNum)
  59.   end if
  60.   p_list = [#imageup: [#comment: "Button Up Image:", #format: #member, #default: memdefault0], #imageroll: [#comment: "Button Rollover Image:", #format: #member, #default: memdefault1], #imagedown: [#comment: "Button Down Image:", #format: #member, #default: memdefault2], #pSoundDown: [#comment: "Sound for DownState:", #format: #string, #default: EMPTY], #pSoundDownChannel: [#comment: "soundChannel:", #format: #integer, #default: "3"], #pSoundRoll: [#comment: "Sound for RollState:", #format: #string, #default: EMPTY], #pSoundRollChannel: [#comment: "SoundChannel", #format: #integer, #default: "3"]]
  61.   return p_list
  62. end
  63.  
  64. on getBehaviorDescription
  65.   return "This is a tri-state button without sounds" & RETURN & "In my opinion this button behaves like it should" & RETURN & RETURN & "PARAMETERS:" & RETURN & "ImageUp:   the cast member for the normal (not pressed state)" & RETURN & "ImageRoll: the cast member for the button when a rollover occurs" & RETURN & "ImageDown: the cast member for the button when a mousedown on the button is valid"
  66. end
  67.